import math
def prod( iterable ):
    p= 1
    for n in iterable:
        p *= n
    return p
def multiply(a):
        equals=a.split("=")
        addends=equals[0].split("*")
        addends.remove("n")
        index=0
        for i in addends:
           addends[index]=float(i)
           index=index+1
        z=prod(addends)
        answer=float(float(equals[1])/z)
        return answer

def division(a):
    equals=a.split("=")
    addends=equals[0].split("/")
    addends.remove("n")
    addends.remove(addends[0])
    index=0
    for i in addends:
       addends[index]=float(i)
       index=index+1
    z=prod(addends)
    answer=float(zfloat(equals[1]))
    return answer

def subtract(a):
    equals=a.split("=")
    addends=equals[0].split("-")
    addends.remove("n")
    index=0
    for i in addends:
       addends[index]=float(i)
       index=index+1
    z=sum(addends)
    answer=abs(float(float(equals[1])-z))
    return answer

def addition(a):
    equals=a.split("=")
    addends=equals[0].split("+")
    addends.remove("n")
    index=0
    for i in addends:
       addends[index]=float(i)
       index=index+1
    z=sum(addends)
    answer=z-float(equals[1])
    return answer

def simplealgebra(a):
    if a.find("-")!=-1:
        print(subtract(a.replace(' ','')))
    if a.find("*")!=-1:
        print(multiply(a.replace(" ","")))
    if a.find("/")!=-1:
        print(division(a.replace(" ","")))
    if a.find("+")!=-1:
        print(addition(a.replace(" ","")))
            
